package com.wxh.multithread;

/**
 * @ClassName: TestSleepThread2
 * @Description: 测试休眠线程
 * @Author wxh
 * @Date: 2021/12/30 14:01
 * @Version V1.0.0
 * @Since 1.8
 */
public class TestSleepThread2 {

    public static void main(String[] args) {
        countDown();
    }

    /**
     * 模拟倒计时
     */
    public static void countDown(){
        int num = 10;
        while (true) {
            try {
                Thread.sleep(1000);
                System.out.println(num--);
                if(num <= 0){
                    break;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
